package com.wanczy.util;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class GetLevel {
	public static int getLevel() {
		int nextLevel = 0;
		Connection conn = null;
		PreparedStatement pstate = null;
		ResultSet res = null;
		try {
			conn = GetDBConnection.getConnection();
			String sql = "select level_sequence.nextval from dual";
			pstate = conn.prepareStatement(sql);
			res = pstate.executeQuery();
			while(res.next()) {
				nextLevel = res.getInt(1);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}finally {
			try {
				res.close();
				pstate.close();
				conn.close();
			} catch (Exception e2) {
				e2.printStackTrace();
			}
		}
		return nextLevel;
	}
}
